Cotterill has agreed a two-year deal with Blues, which will commence on July 1, and he becomes manager Lee Clark's eighth summer signing.
The 26-year-old, who is comfortable on either flank, is the second new arrival from the Keepmoat Stadium, with Mark Duffy having already made the switch to the West Midlands club.
Cotterill, who has made 20 appearances for Wales, began his career with Bristol City before joining Wigan for £2million in 2006.
He only made 21 appearances in two years with the Latics, before going on to join Sheffield United and then Swansea.
Following a brief stint at Barnsley in 2012, Cotterill joined Doncaster, where he made 92 appearances and scored 14 goals.