Off the top of my head, I'd use an array. Then find the "space" square within the array, and select a random square adjacent to the space. Move that selected square into the space. Then repeat. The more times you repeat, the more it'll be shuffled. After shuffling the array, you can then create and draw the squares relative to the array.
If you wanted to show the shuffling as it happens, you could do it without an array, and use overlapping at offset events to check if a tile is in adjacent squares.
Remember to store the positions of the solved puzzle before you shuffle. Then you can easily check if the player has solved it or not.