Middlesbrough have confirmed that Richie Smallwood has joined Rotherham United on loan for the rest of the season.