Othogonal bases $\langle e_1, e_2 \rangle$ :
$|e_1| = 1$
$|e_2| = 1$
$e_1 \cdot e_2 = 0$
$a = p \cdot e_1$
$b = p \cdot e_2$
$p = a \; e_1 + b \; e_2$
The coordinates, $(a,b)$, of $p$ are its projections onto the basis vectors.
Suppose $p = (a,b)$ in the $\langle e_1, e_2 \rangle$ basis.
What is $p$ written in a different basis, $\langle u, v \rangle$?
(Note that the coordinates of $u$ and $v$ must be written in the same $\langle e_1, e_2 \rangle$ basis as the coordinates of $p$.)
We can think of $p$'s transformation into the $\langle u,v \rangle$ basis as $p$'s projection onto $u$ and $v$:
But, writing this as a matrix multiplication:
So we can think of $p$'s transformation into the $\langle u,v \rangle$ basis as a matrix, $\begin{bmatrix} \cdots u \cdots \\ \cdots v \cdots \end{bmatrix}$ , applied to $p$.
Suppose that the $\langle u,v \rangle$ basis is rotated by $-\theta$ from $\langle e_1, e_2 \rangle$. That is, it is rotated clockwise by $\theta$ since positive rotation is counterclockwise:
Then
$\begin{array}{rl} u & = ( \cos\theta, -\sin\theta ) \\ v & = ( \sin\theta, \cos\theta ) \\ \end{array}$
So $\begin{array}[t]{rl} p_{uv} & = \begin{bmatrix} \cdots u \cdots \\ \cdots v \cdots \end{bmatrix} \begin{bmatrix} \vdots \\ p \\ \vdots \end{bmatrix} \\ & = \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix} \begin{bmatrix} \vdots \\ p \\ \vdots \end{bmatrix}\end{array}$
So the standard rotation matrix has in its rows the basis vectors of $p$'s new coordinate system.
Let $R_\theta$ be the matrix $\begin{bmatrix} \cdots u \cdots \\ \cdots v \cdots \end{bmatrix}$ that transforms vectors into a new coordinate system, $\langle u, v \rangle$, that is rotated clockwise by $\theta$.
Let $p_{e_1e_2}$ be the vector $p$, above, which is in the $\langle e_1, e_2 \rangle$ coordinate system.
Let $p_{uv}$ be the same vector, but in the $\langle u,v \rangle$ coordinate system.
Then, in matrix notation: $p_{uv} = R_\theta \; p_{e_1e_2}$.
Then, similarly,
So $p_{uv}$'s transformation back into the $\langle e_1,e_2 \rangle$ basis multiplies the coordinates of $p_{uv}$ by the columns of the matrix $\begin{bmatrix} \vdots & \vdots \\ u & v \\ \vdots & \vdots \end{bmatrix}$.
By thinking of transformations as projections onto basis vectors, we can do exactly the same thing in any dimension. For example, in 3D:
Let $p_{e_1e_2e_3}$ be $p$ in the $\langle e_1, e_2, e_3 \rangle$ coordinate system.
Let $p_{uvw}$ be the same $p$, but in the $\langle u,v,w \rangle$ coordinate system.
Then $p_{uvw} = \begin{bmatrix} \cdots u \cdots \\ \cdots v \cdots \\ \cdots w \cdots \end{bmatrix} \begin{bmatrix} \vdots \\ p_{e_1e_2e_3} \\ \vdots \end{bmatrix}$
And $p_{e_1e_2e_3} = \begin{bmatrix} \vdots & \vdots & \vdots \\ u & v & w \\ \vdots & \vdots & \vdots \end{bmatrix} \begin{bmatrix} \vdots \\ p_{uvw} \\ \vdots \end{bmatrix}$
In summary, it's often useful to think of rotation transformations as a projection onto basis (row) vectors, or as a summation of basis (column) vectors.