You'd need a heuristic to detect what scroll area should be affected by the mouse, like closest scroll bar to the right of the mouse that extends to the mouse's Y coordinate. Then send the app fake mouse click events in that scroll bar's up or down arrows. That works, unless scroll areas are nested, like they are in web browsers.
In that case, you'd scroll the inner scroll area in cases where you're to the left of the inner area, but over the outer one, or scroll far away scroll areas.