Modeling Spacecraft Dynamics via Quaternions