OpenCV get puzzled image

Hi everyone. I want to break the image into puzzles. How can i do it? I’m new in OpenCV, so i need help. if someone can guide me I would be grateful!

there is an android sample doing just this

what have you tried, so far ? please show us !