I honestly have no idea where to even really look for this. I looked on SO but the question were far more complex like detecting cars or complex shapes for games. I merely have a canvas (the HTML5 element) with an image in it that has a bunch of rectangles and squares with images inside of them and want to detect each one, "cut them out", and go through them one by one. The piece I'm stuck on is *finding* the shapes and then getting their coords. These aren't images I'm drawing either, but images others are uploading and then I draw onto a canvas.

Think something like:

```
+------------------+
|  ----  ---  ---- |
|  |  |  | |  |  | |
|  ----  ---  ---- |
|  --------------- |
|  |             | |
|  --------------- |
|                  |
+------------------+

```

And I want to remove each of those 4 blocks so I could go through them one by one like:

```
----     ---     ----     ---------------
|  | =>  | | =>  |  | =>  |             |
----     ---     ----     ---------------

```