That is actually a VERY good question, and deserves an extended answer.
The purpose of sights is simply to provide a means whereby you can visually align the gun in a consistent way so that the point where the bullet strikes coincides with that visual alignment. Theoretically, if a gun is fired from an immovable mechanical rest, the bullets will strike a given target at nearly the same spot every time, regardless of how the sights are adjusted or even if there are no sights installed. Then, one or the other or both sights are shifted up down or sideways until, when viewed together from the rear in their correct relationship (e.g., a post exactly in the middle of a notch and even with the top of the notch), this visual image (your "sight picture") can be superimposed on the point of bullet impact. Adjusting the sights does not really move the point of impact relative to the pistol; it's only relative to the your view of the sights.
In practice, on a pistol, if the front and rear sights are mounted exactly on the gun's centerline coaxial with the bore, a correct sight picture will be more or less coincident with the actual point of impact of the bullet. That's the theory.
A discrepancy to the left or right between the point of aim and the point of impact will be due, at least initially, from the fact that, due to manufacturing variances, the barrel seldom is mechanically positioned perfectly coaxial with the slide (on which the sights are mounted), so the front or rear sight must be moved slightly to compensate for it. Movement left or right is commonly termed "windage", though at the ranges at which a pistol is normally used, wind has nothing to do with it; it's a mechanical imperfection.
Now enter the human factors: the ability of the eye to consistently align the sights, and the ability of the hand to consistently hold the sights aligned at the instant of firing, introduce an additional (and potentially much greater) set of variables between where you think the gun is aimed and where the bullet hits. The business of marksmanship is to minimize all these variables, mechanical and human.
So, to answer the practical question: Yes, centering the rear sight on the slide gives a good starting point, and its validity can be tested on the range simply by shooting as precisely as you are able. When your point of aim coincides laterally with the point of impact, the windage is correctly adjusted --at least for you. A different shooter might "see" the sights differently.
M