I have three 3D coordinate frames: O, A and B, as shown below.

I want to know the rotation matrix RAB between A and B, that is the rotation that is required, with respect to the frame A, to move from A to B.
Let us imagine that all I know, is the rotation matrix RAO between A and O, and the rotation matrix ROB between O and B. By inspecting the above diagram:
$$ R_{AO} = \left [\begin{array}{ccc} 1 & 0 & 0 \\ 0 & 0 & -1 \\ 0 & 1 & 0 \\ \end{array} \right ]$$
$$ R_{OB} = \left [\begin{array}{ccc} 0 & 0 & 1 \\ -1 & 0 & 0 \\ 0 & -1 & 0 \\ \end{array} \right ]$$
So, what is the correct way to determine RAB? There are two suggestions that come to mind:
(1) RAB = RAO ROB
(2) RAB = ROB RAO
Now, my intuition is that (1) is correct, i.e. post-multiplication. This is because I am multiplying everything with respect to the local coordinate frame (as discussed in http://web.cse.ohio-state.edu/~whmin/courses/cse5542-2013-spring/6-Transformation_II.pdf).
However, when I compute this, I get:
$$ R_{AB} = \left [\begin{array}{ccc} 0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 0 \\ \end{array} \right ]$$
Whereas by inspection of the diagram, it should be:
$$ R_{AB} = \left [\begin{array}{ccc} 0 & 1 & 0 \\ -1 & 0 & 0 \\ 0 & 0 & 1 \\ \end{array} \right ]$$
Which, I have noticed, is equal to the pre-multiplication solution of (2).
Please can somebody explain to me why (2) seems to be correct, rather than (1)? I was under the impression that if all your transformations are with respect to the current local frame, then post-multiplication should be done, i.e. multiply the matrices from left to right as you move between each frame. However, when doing the maths, pre-multiplication gives the expected answer.
My sense is that this is due to the fact that you are multiplying matrices on the left. That is, the rotation matrix $R_{AO}$ operates on the vector $(x,y,z)$ by:
$\begin{pmatrix} 1 & 0 & 0 \\ 0 & 0 & -1 \\ 0 & 1 & 0 \end{pmatrix} \cdot \begin{pmatrix} x \\ y \\ z\end{pmatrix}$
and so really, your "post-multiplication" operation is given by (2) rather than (1); that is, post-multiplying the rotation $R_{AO}$ by the rotation $R_{OB}$ is given by the matrix $R_{OB}\cdot R_{AO}$, not $R_{AO} \cdot R_{OB}$. If your multiplication was on the right, it would be given by (1), but then your matrices would change.
In general, this is a group-theoretic law of composition given left multiplication as the group operation.