Put the pattern at every shift of the text in turn and compare left to right until a mismatch.
This interactive visualization needs JavaScript.