How does stack and scan really works?

Hi, I’m trying to understand how does stack and scan works. So far I understand that it scan the sample in a rectangle shape. But there are some questions:
What does the program use as center or zero (starting point)?
x-step and y-step size, they just determine the image size in x and y?
Does stack and scan cover all the sample?

Thanks in advance.

The scan starts at the current position in x,y. The different scan styles use this either as one corner or the centre. Do a couple of small scans of 3x3 images or something to get an idea of what happens

The step size is the number of motor steps in x,y between images. How many steps you want to use will depend on the lens you are using and how much overlap you want between images.

The microscope does not know anything about your sample, so it just does the number of images that you set in x,y at the spacings that you set. If you have measurable image criteria for what the sample looks like you could make a program using the python library to scan only the part of the slide where your sample is.