Applying a stencil over a $N$-dimensional grid is quite common in numerical schemes. I am wondering how the operation could be viewed from the mathematical standpoint. An operation that would take as an input a grid $G$ in $N$-dimension and a stencil $S$ and would produce a set $X$ of all of the possible application of the stencil to the grid.
For example for the following 2D grid $G$
and a 2D stencil $S$ of $2 \times 2$ squares, the output would be the set of $\left\{\begin{bmatrix}1&2 \\\ 4&5\end{bmatrix}, \begin{bmatrix}2&3 \\\ 5&6\end{bmatrix}, \begin{bmatrix}4&5 \\\ 7&8\end{bmatrix}, \begin{bmatrix}5&6 \\\ 8&9\end{bmatrix}\right\}$.
What would be the right way of looking at it from a mathematical standpoint? I'm guessing it may be viewed as some kind of product between two graphs, or maybe some kind of product between two spaces. Even if the formalized notion does not fit exactly what I describe, all I need is a good entry point to science papers or books.
