Use Jason's code to calculate the rotation matrix. I am unsure on the order of the Euler angles.