Hey, I liked your question so I thought i should work on it. Here m adding the code to change matrix as shown by you in example.
Here suppose 'a' is your original matrix of size (2N x 2N) and I have take one `tmp` matrix to store value. it will also be of same size
initialize tmp matrix at the time of declaration, like int tmp[2*n][2*n]={0};
for(int i=0;i<2*n;i++){
for(int j=0;j<2*n;j++)
{
if(i<n && j<n)
tmp[i][j+n]=a[i][j];
else if(i<n && j>=n)
tmp[i+n][j]=a[i][j];
else if(i>=n && j<n)
tmp[i-n][j]=a[i][j];
else if(i>=n && j>=n)
tmp[i][j-n]=a[i][j];
}
}