How to calculate to structure tensor?
The $S$ matrix is finally of $2\times2$ the size of the initial image. Gathering it is a bigger image is somehow misleading. You effectively get a $2\times 2$ matrix at each pixel of the original image, by gathering values from the $4$ submatrices at corresponding locations. 

Structure tensor provides local information. Do not forget to use smoothed directional derivatives as well when computing $I_x$ and $I_y$. You can for instance compute them with Difference of Gaussians (DoG) operators.
More discussion in  How do I implement the Structure tensor (in Matlab)? or Structure tensor tutorial.