Not sure of all the details of your required config but one of the following scenarios should work for you:
1. Use both set of ports (1-2 and 3-4)as access ports (switchport mode access) and set the correspondent vlan (switchport access vlan x)for the red traffic. Use the same config for ports 3 and 4.
2. Use both set of ports as trunk ports (switchport mode trunk) and define the native vlan (untagged traffic) as vlan red and do the same for the other ports and define the native as green. However this will allow traffic from other vlans but tagged also, vlans going over this link can be restricted by the use of command: "switchport trunk allowed vlan"