//pseudocode, you can do this in GUI
loop through all such units you want to check, using index1 as counter
Set U = units[index1]
Set UX = X coordinate of U
Set UY = Y coordinate of U
loop though rects using index2 as counter
Set mx = rectsmx[index2] //min x
Set Mx = rectsMx[index2] //max x
Set my = rectsmy[index2] //min y
Set My = rectsMy[index2] //max y
//There are functions to get these min and Max coords in jass, may have to look to locactions to do it in GUI
if (UX <= Mx) and (UX >= mx) and (UY <= My) and (UY >= my) then
//The index1'th unit is in the index2'th rect
//Do whatever here
endif
endloop
endloop