Here is the code.
Quick explanation: the image is split into 4 (vertically and horizontally halved) at each step. Then each quarter of the image is labelled with a digit from 1-4 (in this case I think I made it match with the math-quadrant). This process is repeated with the each of the quarters until the boxes are smaller than a pixel. If the label matches the regex, then the box is coloured in.