Light from an object which is higher than the pinhole has to travel downwards to pass through the pinhole. It continues downwards and hits the screen below the level of the pinhole. Conversely, light from an object which is lower than the pinhole will travel upwards to pass through the pinhole and will hit the screen at a higher level.