Separate mouse collision along borders with complex shapepainter shapes

If you would make each province different color
Then there is read pixels extension and you can use to read color of pixel right under your mouse cursor

And so there goes your selecting method

Here
Example how to use read pixels