Some of the squares of a $3 \times 3$ board are shaded in such a way that in each row and in each column there is at least one black square. We regard symmetries (via rotation or reflection) of the same coloring as distinct, like the pair of shadings below. Find the total number of ways in which the board can be shaded in this way.
My thought is to treat the rows and columns separately first, then apply PIE. But I don't know how to carry out this plan. Thanks in advance!

For a rectangular grid of $n$ columns and $m$ rows of squares call the set $\xi$ that of total square shadings, then:
Call $A_k$ the set of shadings of our $n\times m$ rectangle with column $k$ empty, then, deleting row $k$ we have that $|A_k|$ is just the shadings of an $(n-1)\times m$ rectangle
$$|A_k|=(2^{n-1}-1)^m$$
the intersection of any two of these sets is just the shadings of an $(n-2)\times m$ rectangle
$$|A_{k_1}\cap A_{k_2}|=(2^{n-2}-1)^m$$
and so on:
$$|A_{k_1}\cap A_{k_2}\cap A_{k_3}|=(2^{n-3}-1)^m$$ $$\vdots$$ $$|A_{k_1}\cap A_{k_2}\cap \cdots\cap A_{k_{n-1}}|=(2^1-1)^m=1$$ $$|A_1\cap A_2\cap\cdots \cap A_n|=(2^0-1)^m=0$$
Now call
$$S_r=\sum_{k_1\lt k_2\lt\cdots\lt k_r}|A_{k_1}\cap A_{k_2}\cap \cdots\cap A_{k_{r}}|=\binom{n}{r}(2^{n-r}-1)^m$$
The principle of inclusion-exclusion says (setting $\xi\equiv A_0$)
$$|(A_1\cup A_2\cup\cdots \cup A_n)'|=\sum_{r=0}^{n}(-1)^rS_r$$
Hence the general desired count for no empty rows or columns for an $n\times m$ grid is
$$|(A_1\cup A_2\cup\cdots \cup A_n)'|=\sum_{r=0}^{n}(-1)^r\binom{n}{r}(2^{n-r}-1)^m$$
In this case $n=m=3$, then