Insert the rectangles into a data structure where they are sorted by their bottom coordinate x1. Using e.g. a self-balancing binary search tree, this would have complexity O(N.LogN), and allow to traverse the tree in order in O(N), with N being the number of rectangles. In the example that would be:
[R1, R3, R2]
While inserting the rectangles into the tree, also keep a sorted list of all the unique bottom and top coordinates y1 and y2. In the example that would be:
[1, 3, 4, 5, 6, 7]
Now we will treat each horizontal slice between two consecutive y-coordinates as a 1-dimensional problem (similar to the first method in this answer).

Iterate from the start of the rectangle tree over all the rectangles that fall in this slice (remember the rectangles are sorted by y1, so they are grouped together in the beginning), and make a sorted list of their unique x-coordinates, with a value for each to which you add 1 if it is the left coordinate, and subtract 1 when it is a right coordinate. If you encounter rectangles whose top coordinate equals the slice's top coordinate, remove them from the rectangle tree, which can be done in O(1). For the first slice in the example, with y=1~3 and height 2, that would be:
[1: +1, 5: -1]
If we iterate over it, we find a zone of width 4 (and thus area 8) that is part of 1 rectangle.
For the second slice in the example, with y=3~4 and height 1, that would be:
[1: +1, 3: +1, 5: -1, 8, -1]
If we iterate over it, we find a zone of width 2 (and thus area 2) that is part of 1 rectangle, a zone of width 2 (and thus area 2) that is part of 2 rectangles, and a zone of width 3 (and thus area 3) that is part of 1 rectangle. So any area that is part of k rectangles is added to a total. And so on.
Creating the rectangle tree is O(N.LogN), creating the slice list is O(N.LogN), iterating over the slices is O(N) and within each slice creating the sorted x-coordinate list is O(N.LogN), for a total of O(N2.LogN), independent of how large the rectangles are, how large the total area is, and how much overlap there is between rectangles or clusters of rectangles.