How to get the position of green rectangle and set it to POSX & POSY? I'm trying to reposition it when application loads, and when I click a button the text box should move to the position of the rectangle.
import SwiftUI
       class EnvironmentVariables: ObservableObject {
            @Published var POSX: CGFloat = 0.0
            @Published var POSY: CGFloat = 0.0
        }
       struct ContentView: View {
               var body: some View {
                    
                    ZStack {
                   Rectangle ()
                        .frame(width: 5, height: 5)
                        .zIndex(2)
                        .foregroundColor(.green)
                    } .frame(width: 200, height: 200, alignment: .center)
                }
           
        }
         struct docker: View {
            
            @EnvironmentObject var environmentVariables: EnvironmentVariables
            //@StateObject  var environmentVariables = EnvironmentVariables()
            
            
            var body: some View {
            VStack {
                
                Text("The text")
                    .background(.green)
                    .position(x: environmentVariables.POSX, y: environmentVariables.POSX)
            }
            .environmentObject(environmentVariables)
            }
            
        }
