For starters, we need to remember that sin is not the mere breaking of a rule. It is an action that damages our relationship with God and each other. So it is not as simple as saying, “If I don’t know its a sin, can I do it anyways?” Because even if we don’t know it is wrong it still has bad effects on our relationships.
What this comes down to is one’s culpability for the immoral action. Even if the person doesn’t know its a sin, if the motivations for the action was lust, greed, pride, etc. then there is still culpability present. If the person truly thought (wrongly) that the action was good and loving and that was their intention, then while it still objectively damages relationships the person would not have moral culpability for the action.
Imagine if a parent thought a lead drinking cup was good for a child to drink out of. Regardless of the parent’s intentions there are still consequences to the action. If the parent truly thought this was a good thing and simply had no practical way to know better then we would have pity for the person. However if they were simply too lazy, too stubborn, or didn’t care enough to find out the truth, we would judge the person harshly.