How to repeat a matrix into a bigger one along both dimensions?