Hey Renoald and welcome to the forums.
One problem that you have is that a rotation matrix preserves the dimension and is a basis which means that the matrix has to be square (even if some values don't contribute in the form of zero entries).
I think it would be helpful if you gave the exact dimensions of your matrices for X and X0. If these are vectors in a Euclidean space, then this is a very well understood problem, but if they are matrices then we will need a more general result.
So lets say X is a matrix with 3 rows and 2 columns, X will be a 3x2 matrix.