Combinatorics: on the number of Celtic knots in an n × m frame Everybody has seen a Celtic knot like the ones below.
Mathematically speaking  a rectangular Celtic knot of size $(n, m)$ may be built as:
We draw the boundaries of a $2n \times 2m$ rectangle .
Then we draw some barriers, which are horizontal or vertical segments whose starting, ending and crossing points all have integer even-sum coordinates.
Let $K_{n, m}$ be the number of Celtic knots of size $(n, m)$, two knots that differ only by rotations and reflections are considered the same.
Of course $K_{0, 0} = 1$, $K_{1, 1} = 1$, $K_{n, m} = K_{m, n}$.
I have been able to calculate $K_{1, n}$, but failed to calculate $K_{2, 2}$.
Any idea?
Explanation of the examples:
In #8 the green barrier starts at point $(0, 2)$ whose sum is even, and ends at point $(4, 2)$ whose sum is even. The orange barrier starts at point $(1, 1)$ whose sum is even and ends at point $(3, 1)$ whose sum is even.
In #18 the green barrier starts at point $(1, 3)$ whose sum is even, and ends at point $(3, 3)$ whose sum is even. The orange barriers start at point $(3, 1)$ whose sum is even and ends at point $(3, 3)$ whose sum is even.
In the third example, the green and the red barriers cross each other at point $(2, 3)$ whose sum is odd, hence not valid.
The 21 $K_{2, 2}$ I know:

Examples of the construction:

Celtic knots:


Thanks to Brian, I've been able to solve the general problem.
I wrote a 9-page document to explain it all, unfortunately I cannot upload it here, so I give you the final results (the formulas could be written with just one formula but it would be a lot more confusing)
Non Square Celtic Knot
$\begin{array} {|c|r|l|}\hline
n \text{ even} / m \text{ even} & K_{(n, m)} = & \dfrac{3^{2nm - (n+m)} + 3^\frac{2nm - (n+m)}{2} + 3^\frac{2nm - m}{2} + 3^\frac{2nm - n}{2}}{4} \\ \hline
n \text{ even} / m \text{ odd} & K_{(n, m)} = & \dfrac{ 3^{2nm - (n+m)}+ 3^\frac{2nm - (n+m)+1}{2} +  3^\frac{2nm - m -1}{2} + 3^\frac{2nm - n}{2}}{4} \\ \hline
n \text{ odd} / m \text{ even} & K_{(n, m)} = & \dfrac{3^{2nm - (n+m)} + 3^\frac{2nm - (n+m)+1}{2} + 3^\frac{2nm - m}{2} + 3^\frac{2nm - n - 1}{2}}{4} \\ \hline
n \text{ odd} / m \text{ odd} & K_{(n, m)} = & \dfrac{ 3^{2nm - (n+m)} + 3^\frac{2nm - (n+m)}{2} + 3^\frac{2nm - m -1}{2} + 3^\frac{2nm - n - 1}{2}}{4} \\ \hline
\end{array}$
Square Celtic Knots
$\begin{array} {|c|r|l|}\hline
\rule[-3ex]{0pt}{8ex}n \text{ even}  & K_{(n, n)} = & K_{(n, n)} = \dfrac{3^{2n^2 - 2n} + 2*3^\frac{n(n-1)} {2} + 3*3^{n(n-1)} + 2*3^\frac{2n^2-n} {2}}{8}     \\ \hline
\rule[-3ex]{0pt}{8ex}n \text{ odd}   & K_{(n, n)} = & K_{(n, n)} = \dfrac{ 3^{2n^2 - 2n} + 2*3^\frac{n(n-1)} {2} + 3*3^{n(n-1)} + 2*3^\frac{2n^2-n-1} {2} }{8} \\ \hline
\end{array}$
