Bash script, make use of imagemagick to cut images to small grids