Tracking control of latent dynamic systems with application to spacecraft attitude control