I am trying to understand a basic formula in a Celestial Mechanics reference. The formula is for the position of the Moon in a geocentric frame. The reference claims in line (981) that this should be given by $$ \vec{r}_M \approx a_M ( \cos \lambda_M, \sin \lambda_M, \iota_M \sin(\lambda_M - \bar{\omega}_M) ),$$ where $\lambda_M$ is the Moon's ecliptic longitude, $\bar{\omega}_M$ is the lunar ecliptic longitude of the ascending node, $\iota_M$ is the small inclination of the Moon's orbit with respect to the ecliptic, and $a_M$ is the distance from the Moon to the Earth.
Note that in the frame in question, the Earth's angular velocity is given by $\vec{\omega} = \omega (-\sin(\theta) \sin(\phi), \sin(\theta) \cos(\phi), \cos(\theta))$. $\phi$ is the angle of diurnal rotation, $\theta$ is the angle between the Earth's diurnal rotation axis and the ecliptic. Can someone show me the derivation of $\vec{r}_M$ in terms of explicit rotation matrices?
I can quickly reproduce the formula for the Earth's angular velocity about its axis $\vec{\omega}$. I assume that the Earth's rotation axis is about $(0,0,1)$ to begin with, and then apply a clockwise rotation of $\theta$ about the $x$-axis, followed by a counterclockwise rotation about the $z$-axis to obtain $$ \vec{\omega} = \left( \begin{matrix} \cos \phi & -\sin \phi & 0 \\ \sin \phi & \cos \phi & 0 \\ 0 & 0 & 1 \end{matrix} \right) \left( \begin{matrix} 1 & 0 & 0 \\ 0 & \cos \theta & \sin \theta \\ 0 & -\sin \theta & \cos \theta \end{matrix} \right) \left( \begin{matrix} 0 \\ 0 \\ 1 \end{matrix} \right) = \left( \begin{matrix} - \sin \phi \sin \theta \\ \cos \phi \sin \theta \\ \cos \theta \end{matrix} \right), $$ precisely as claimed. How can we find the result for the lunar position $\vec{r}_M$?