Hello in in,
I dont know exactly if buses or trains go between the points you described, but in all the extensive research that i've done, i would say Rijeka is definitley the larger city of those three, and therefore probably has more transportation options than Pula or Rovinj. You may not have a choice but to go to Ljubljana and transfer there for your final destination
Either way, check out these websites for trains:
http://www.slo-zeleznice.si/en/ - Slovenian train schedules
http://www.hznet.hr/eng/ - Croatian train scheduled
There won't be buses running from Rovinj, that's for sure, but Pula and Rijeka are possibilities. Since both countries don't have a national bus line, it's difficult to tell until you actually get to the town and visit the bus station to look at the schedules.
Sorry i couldn't be more helpful. I'm actually struggling with a similar problem right now of trying to plan everything to the minute, and it's very difficult since the info isn't always available online. Just going to have to wing it!