My idea was to use flood fill, but it won't work because you have text in your rectangles. Drawing a rectangle with transparency over your map can work.
Recording: manage mouseClick(), put mouseX, mouseY in a PVector, store it in an array list. On a keyPressed(), for example, you can put the coordinates in an array of strings and use saveString() to put them in a file.
Sorry, no time right now for real code.