Let us say the rectangular glass slab has two surfaces S1 and S2. They are parallel. When light rays are incident on S1 from air at angle α (not 90), refraction takes place with an angle β and the colors are separated by a little angle as per the law of refraction.
When the refracted ray falls on the other surface S2, the angle of incidence now becomes β and on using the formula we find that angle of emergence is α in air. The situation is symmetric at S1 and S2. So the light colors combine again to align themselves at angle of emergence = α and propagate as a parallel beam of rays together.
At S2, violet color bends less towards normal and compensates for more bend at S1. At S2 red color bends.
Actually there is a lateral shift in the position of rays, that is different for different colors. But is very small and if there are a lot of rays, then it will not noticeable.