This script generates a new asset cropped with the MxN size from an input path image.
1. Put the tilemap in the folder;
2. Rename in the script to the name of the tilemap asset;
3. Create a new folder "new_asset";
4. Change the MxN sizes to fit your tilemap remap;
5. Run the script.
The asset used in the example is from schwwarnhild. I do not own the asset used in this example.
To test the example just run the script without changing anything.