This is probably a nonsensical question, but I'm having trouble wrapping my head around it. I'm thinking of the classic scenario where a stationary observer is watching a spaceship move horizontally. It makes perfect sense to me that a beam of light bouncing up and down will appear to move more slowly vertically, since it has to also move horizontally. This produces the time dilation effect. However, I don't see why this same dilation factor has to apply to a beam of light moving horizontally. This is the way that I have seen length contraction derived. It sounds peculiar, but couldn't there be a different time dilation factor for objects moving horizontally versus vertically on the spaceship?
edit: I believe this can be explained by thinking about a beam of light moving diagonally on the spaceship, but I'll leave the question up in case someone has a better explanation.