The body rotates according to the input attitude; the solar panels and body axes (X = red, Y = green, Z = blue) follow. The yellow vector shows the unit axis n of the axis-angle rotation; the arc indicates the angle α.
$$q = \cos\tfrac{\alpha}{2} + \sin\tfrac{\alpha}{2}\bigl(n_x\,i + n_y\,j + n_z\,k\bigr),\quad q_1\,q_2 = (\text{rotation composition})$$
Rotation by angle α about a unit vector n=(n_x,n_y,n_z). Quaternion multiplication is non-commutative (q1·q2 ≠ q2·q1).
$$q_{ZYX} = \begin{pmatrix} c_r c_p c_y + s_r s_p s_y \\ s_r c_p c_y - c_r s_p s_y \\ c_r s_p c_y + s_r c_p s_y \\ c_r c_p s_y - s_r s_p c_y \end{pmatrix},\quad c_\ast=\cos\tfrac{\ast}{2},\,s_\ast=\sin\tfrac{\ast}{2}$$
Tait-Bryan ZYX (yaw → pitch → roll) Euler-to-quaternion conversion. φ: roll, θ: pitch, ψ: yaw.
$$|q| = \sqrt{w^2 + x^2 + y^2 + z^2} = 1,\qquad q^{-1} = q^* / |q|^2,\qquad q^* = (w,-x,-y,-z)$$
Unit-quaternion condition and the inverse via the conjugate q*. In flight code, renormalise q ← q/|q| every step.