Example 3. On the sides $AB, BC, CD, DA$ of rectangle $ABCD$, there are $n, p, n, q$ points respectively, and lines are drawn connecting every two points on opposite sides. If no three lines intersect at a point inside the rectangle, how many regions do these lines divide the rectangle $ABCD$ into?
Consider the intersection points of these lines within the rectangle, they can be divided into 3 categories: one category is the intersection points of lines connecting points on the edges $A B$ and $C D$. Each such intersection point corresponds to two points on $A B$ and two points on $C D$, and vice versa. There are $C_{m}^{2} C_{0}^{2}$ such intersection points; another category is the intersection points of lines connecting points on the edges $B C$ and $D A$. Similarly, there are $C_{p}^{2} C_{q}^{2}$ such intersection points; the third category is the intersection points of a line connecting points on $A B$ and $C D$ with a line connecting points on $B C$ and $D A$. Each such intersection point corresponds to one point on each of the four sides of the rectangle, and vice versa. There are $C_{m}^{1} C_{n}^{1} C_{p}^{1} C_{8}^{1}$ such intersection points. In summary, the number of intersection points is $C_{m}^{2} C_{n}^{2} + C_{p}^{2} C_{q}^{2} + m n p q$. The number of lines is clearly $m n + p q$. By Theorem 1, the number of regions these lines divide the rectangle into is
$$
S = C_{m}^{2} C_{n}^{2} + C_{p}^{2} C_{q}^{2} + m n p q + m n + p q + 1
$$