Keep in mind the User Profile Service has no impact on People Picker nor security.
One thing SharePoint doesn't support is foreign security principals, that is, if you assign a UserB in DomainB to GroupA in DomainA. Is that what you're attempting to do, or are you attempting to assign GroupB in DomainB to a SharePoint ACL?
How do you have your People Picker Settings configured (SPWebApplication.PeoplePickerSettings)? Even in a two-way trust, this will be required for name resolution.