I'm looking for a definition rule of a position vector. I have a set of 2D random points and need rotate its from the center of the plot.
I have tried to use the angle $a=\frac{\pi}{40}$ and the rotation matrix $$M=\left[ \begin{matrix} cos(a) & -sin(a) \\ sin(a) & cos(a) \\ \end{matrix} \right].$$ Now the rotation works from the corner (0,0). Below is small simulation on $R$.
data <- data.frame(x=runif(2000), y=runif(2000))
plot(data, pch = 20)
angle <- pi/40
M <- matrix( c(cos(angle), -sin(angle), sin(angle), cos(angle)), 2, 2 )
points( data.matrix(data) %*% M, pch = 20, col="black" )
Question. How to define the position vector in order to move rotation from the corner $(0,0)$ to center $(1/2, 1/2)$?
Edit. My attempt after the Math Lover's answer is:
set.seed(3009)
n <- 4000
ds <- matrix(runif(n*n), n, 2) # dataset
centre <- c(1/2, 1/2)
angle <- pi/30
M <- matrix( c(cos(angle), -sin(angle), sin(angle), cos(angle)), 2, 2 )
ds2 <- centre + M %*% matrix(c(ds[,1] - centre[1], ds[,2] - centre[2]), 2, n)
rx <- range(ds2[1,])
ry <- range(ds2[2,])
plot( ds, pch = 20, xlim = rx, ylim = ry)
points(ds2[1,], ds2[2,] , pch = 20, col="black")


Let $\begin{bmatrix}x\\ y\end{bmatrix}$ be the position vector. You need to compute $$\begin{bmatrix}x' \\ y'\end{bmatrix} = \begin{bmatrix}1/2 \\ 1/2\end{bmatrix} + M\begin{bmatrix}x-1/2 \\ y-1/2\end{bmatrix}. \tag 1$$ Eq. $(1)$ first translates the axes to $(1/2,1/2)$ then rotates the axes and then translates the axes back to $(0,0)$.