Your model is exactly a Convolution with Uniform Kernel where the output is what is called the Valid Part of the Convolution.
In MATLAB lingo it will be using conv2(mA, mK, 'valid').
So the way to solve it will be using a matrix form of the convolution and solving the linear system of equations.
Let's use the Lenna Image as input:
We have a uniform ...
Below is an attempt to do what you're asking in Python.
First, the dashed item:
Then the sensor. It's uniform,so just comes out as black.
Then the output of the sensor (convolve the thing to be measured with the sensor).
Finally, the output of the deconvolution.
Note that the output is not precisely the same as the input, but it's pretty close.