Everywhere on the back wall that can see the barn will be exposed to red light, and everywhere that can see the tree will be exposed to green light. Everywhere on the back wall that has a line of sight to the lake will be exposed to blue light. The light coming in from outside goes through the window in straight lines. The blue lake is reflecting blue light through the window on the the wall where you were standing when you could see it. The green tree is reflecting green light straight through the window and on the the middle of the back wall. The red barn is reflecting red light through the window onto the spot on the back wall where you were standing when you walked left. If it's nice and bright outside, and there's no other source of light, you'll notice a blurry image of the view projected on the back wall. Now, turn around and look at the back wall. From each point on the back wall, you can only see one little patch of the outside view through the tiny window.
Move all the way over to the left, now you can see a little patch of the red barn. Move to the right, and look through the window, now you can see a bit of the blue lake. If you stand with your back to the wall opposite the window, you can only see a bit of the green tree. As you back up, your field of view through the window gets narrower. You put your face up to the window, and you can see a blue lake on the left, a green tree in the middle, and a red barn to the right.
To particularly address your second question "Why do tiny holes act like lenses?" - Imagine that you're standing in a dark room with one tiny window looking out over a sunny landscape.