Split image into tiles
convert image.png -crop 2x3-40-20@ +repage +adjoin tile-%d.jpg
# 2: horizontal tile numbers
# 3: vertical tile numbers
# 40: horizontal padding
# 20: vertical padding
Stack images
# horizontal stacking
convert <images> -gravity center -append "output.png"
# vertical stacking
convert <images> -gravity center +append "output.png"
Rotate image
convert -rotate 90 image.jpg output.jpg