Equivalent example using ImageMagick (where -ordered-dither might be o2x2, o4x4, or o8x8):
magick input.png -remap palette.png -ordered-dither o4x4 output.png
(Edited to remove link to the image-effects crate, which looked promising but does not actually seem to have a functional ordered dither implementation.)