This script has issues with tiles that have transparent pixels.
j5.jpg
j6.jpg
I was thinking maybe creating the shuffled tiles in a new layer would fix it? Does anyone here know how to do that?