If two congruent rectangular regions overlap, their intersection will be a convex polygon with A sides and their union will be a non-convex polygon with B sides.
Find all possible combinations (A,B).
For example:
-----
| |
| --+--
| | | |
--+-- |
| |
-----
is one way of achieving the combination (4,8)