There are just two conditions that two rectangles can intersect or not. Draw out all possibilities and you can find out the solution.
class Solution {
public:
int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) {
int size1=(D-B)*(C-A);
int size2=(H-F)*(G-E);
if(E>=C||F>=D||A>=G||B>=H)
return size1+size2;
return size1+size2-(min(D,H)-max(B,F))*(min(C,G)-max(A,E));
}
};