Casemiro has joined Real Madrid on loan from Sao Paulo until the end of the season, with an option to make the move permanent.