It is called a slide viewer.
Unlike photographic negatives, where the darkest parts of the image are lightest and vice-versa, photographic slide film produced a positive image directly on the film that could be viewed as is. "Slide" film is more properly called reversal film. Color slides are sometimes called "color reversal film" because not only are the brightest parts of the image preserved on the film the brightest parts of the scene, but the colors were correct instead of inverted as they are with color negative film.
One common way of viewing slide film was via a slide projector that shone light through the film and a lens that projected the image on a screen, much like an analog movie projector did. This usually required viewing in a darkened room with a screen (kind of like a movie theater, only on a smaller scale).
An easy way to view slides without a projector or a darkened room with a screen was to hold them up to a light source and let the light shine through them. But 135 format ("35mm") film slides are fairly small. A viewer like the one you have found included a set of lenses that magnified the slide while allowing ambient light from behind the slide to illuminate it without the need for a projector, screen, and a darkened room.

More contemporary versions include their own light source and are viewable without needing to hold them up to one's eye.

One popular toy that was around back when I was growing up was called a 'Viewmaster'. It was basically a stereoscopic slide viewer that used discs with 14 small slides. This produced seven stereoscopic images, as each image required a right and left slide for each eye. The images were captured by a stereoscopic camera with two lenses arranged next to one another like two eyes. The discs were arranged in such a way that each push of the lever on the side advanced the disc by two sets of frames, with the intermediate set of frames upside down to be viewed when the disc had been nearly half-rotated around.


the little white squares that are in the back
. Boy. I. Am. So. Old.