Generate the Convolution Matrix of 2D Kernel for Convolution Shape of `same`
I cannot test this on my computer because I do not have the convtmx2 function, here is what the MATLAB help says:

http://www.mathworks.com/help/toolbox/images/ref/convmtx2.html

T = convmtx2(H,m,n) returns the convolution matrix T for the matrix H. If X is an m-by-n matrix, then reshape(T*X(:),size(H)+[m n]-1) is the same as conv2(X,H).

This would get the same resulting convolution of conv2(X,H) but then you would still have to pull out the correct piece of the convolution.