You will need some kind of reference switch on the shaft (microswitch, hall, proximity, whatever) to detect when the shaft is the "home position". Then, at startup, take a step check the input, and keep doing that in a loop until the switch is detected.