Finding latitude in a tilted coordinate system Suppose I have a sphere where $\varphi = 0$ is vertical, so I can have lines of latitude where $\varphi = \frac{\pi}{2}$ is pointing to the "equator". 
My question is, suppose I tilt my coordinate system so that $\varphi' = 0$ is pointing towards some $\varphi_0$. How do I find the latitude in the original coordinate system when I'm given $\varphi'$ and $\theta'$ in the new coordinate system?
I've been guessing things like $$\cos(\varphi_0 + \varphi'\cos(\theta'))$$
but that's not correct. Any ideas?
Edit: Added pic for clarity. The green dots are at the same $\varphi'$, but at different $\theta'$.

Ok, the solution comes from simply applying rotation matrices. To simplify, I can always make $\theta_0=0$ for my problem, but the same process applies otherwise. The trick is to treat $\theta=0$ as the $x$ axis, and the vertical as the $z$ axis. Then $\varphi$ and $\theta$ become rotations about the $y$ and $z$ axes, in that order. So first we take the point (0,0,1) at the top of the (normalized) sphere and rotate it by $\varphi_0$ around the $y$ axis, (0,1,0). I will use the notation from the Wiki page.
$$\begin{bmatrix} x'\\y'\\z'\end{bmatrix} = R_z(\theta_0)R_y(\varphi_0)\begin{bmatrix}0\\0\\1\end{bmatrix} = \mathbf{u}$$
This $\mathbf{u}$ becomes the new $z'$ axis for the next rotations. The new $y'$ axis is given by $\mathbf{v} = (0,0,1)\times\mathbf{u}$, but this is simply (0,1,0) still for $\theta_0=0$. Further down on the Wiki page is a formula for rotation about a general axis. So now we first perform a rotation about $\mathbf{v}$ by $\varphi'$ and then we perform a rotation about $\mathbf{u}$ by $\theta'$. 
$$\begin{bmatrix} x''\\y''\\z''\end{bmatrix} = R_u(\theta')R_v(\varphi')\begin{bmatrix}x'\\y'\\z'\end{bmatrix}$$
This z'' is the cosine of the latitude (because we divided by r to normalize the sphere radius). For $\theta_0=0$, simplifying the matrix multiplications gives,
$$z'' = \frac{1}{2}\sin(2\varphi_0)(1-\cos\theta')\sin(\varphi_0+\varphi') + \left[\cos\theta' + \cos^2\varphi_0(1-\cos\theta')\right]\cos(\varphi_0+\varphi')$$
which simplifies to,
$$z'' = \cos(\varphi_0)\cos(\varphi') - \sin(\varphi_0)\sin(\varphi')\cos(\theta')$$
