Picture: http://xs227.xs.to/xs227/08194/draw931.jpg

I have this matrix where each cell has N of width and M of height. (I know they appear to have diferent sizes but paint s*cks :P)

I have the values of p1 and p2 (x and y) given by p1[x] and p1[y], p2[x] and so on...

I have the (x,y) of the center C (of every cell, not only the 10th one).

I know the size of the whole matrix given by P(width) and Q(height).

The objective is: To find out all areas that include that blue box.

In this example areas 5 6 7 8 9 10 11 12 13 and 14 include it.

The box can have various sizes..

I cant find a good algorithm, can you help me? Thanks!