I have two polygons layers (a squares grid (blue in image) and a rectangles grid (green in image)). Because the different polygon sizes, different squares overlap with a single rectangle. I need to find the square with the highest overlapping area for each rectangle, so at the end, I could assign each square to one rectangle. Somehow, I would like to filter just the rectangles with squares assigned after applying this rule. Notice that two squares could be assigned to the same rectangle.
Just to have in mind: the squares don´t have the same area, as in the borders it may be an incomplete square (see image), but still need to know in which rectangle fall the majority of its area.
I am using QGIS.