I frequently have to extract rectangular tile images that are laid out in a grid in a single PNG. The image contains a grid of M x N tiles. The upper-left corner of the upper-left tile in the grid is at offset (X, Y) in pixels. Each tile is WxH pixels in size. In addition, each tile in a row is DX pixels from upper-left corner to upper-left corner (so that DX >= W), and each column is DY pixels below the one above it (DY >= H).
In this picture, M=3 and N=2
![Image](https://i.imgur.com/EZIP6pp.png)
Give all these variables, could someone please tell me what command to use to extract the six tiles into their own PNG files? I'm assuming it's using the 'convert' command.
Thanks.