Universal motion-based control and motion recognition