If you want rotation along the y axis instead of the z axis, then the image will appear foreshortened (narrower), thus the width is reduced. So you can simply use imresize() to calculate the new size. The new number of columns will be
theta = pi/12;
[rows, columns, numberOfColorChannels] = size(originalImage);
newColumns = columns * cos(theta);
rotatedImage = imresize(originalImage, [rows, newColumns]);
This will be like you're tilting the right edge of the image towards you as you look down along the z axis to it (looking at the image perpendicularly).