A short guide to thee and thou

We all know words like thou and thee from our time studying Shakespeare in school, but what’s the actual difference between these archaic forms and the modern you, and when would Shakespeare have actually used thou, thee, thy or thine?